package com.sloera.java.common.tool.entity;

import com.sloera.java.common.tool.service.IResult;
import lombok.AllArgsConstructor;
import lombok.Getter;

import javax.servlet.http.HttpServletResponse;

/**
 * @author SloeraN
 * @version 1.0
 * @class com.sloera.java.common.tool.entity.CommonResultCode
 * @date 2020/8/12
 */
@Getter
@AllArgsConstructor
public enum CommonResultCode implements IResult {

    /**
     * 操作成功
     */
    SUCCESS(HttpServletResponse.SC_OK, "操作成功"),
    /**
     * 操作失败
     */
    FAILURE(HttpServletResponse.SC_BAD_REQUEST, "操作失败"),
    /**
     * 请求未授权
     */
    UNAUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "请求未授权"),
    /**
     * 404 没找到请求
     */
    NOT_FOUND(HttpServletResponse.SC_NOT_FOUND, "404 没找到请求"),
    /**
     * 服务器内部错误
     */
    INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "服务器内部错误");

    /**
     * 状态码
     */
    final int code;
    /**
     * 消息
     */
    final String message;

}
